package com.example.administrator.maizuofilm.card.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.example.administrator.maizuofilm.BaseFragment;
import com.example.administrator.maizuofilm.R;
import com.example.administrator.maizuofilm.mine.Variable;
import com.example.administrator.maizuofilm.mine.other.Indent;
import com.example.administrator.maizuofilm.mine.other.Login;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;

/**
 * Created by Administrator on 2016/7/11.
 */
public class CardFragment extends BaseFragment implements View.OnClickListener {
    @InjectView(R.id.iv_help)
    ImageView ivHelp;
    @InjectView(R.id.scan_title)
    RelativeLayout scanTitle;
    @InjectView(R.id.button_erweima)
    RelativeLayout buttonErweima;
    @InjectView(R.id.linear_shitika)
    RelativeLayout linearShitika;
    @InjectView(R.id.linear_dianzika)
    RelativeLayout linearDianzika;
//    @InjectView(R.id.iv_help)
//    ImageView ivHelp;
//    @InjectView(R.id.button_erweima)
//    Button buttonErweima;
//    @InjectView(R.id.linear_shitika)
//    LinearLayout linearShitika;
//    @InjectView(R.id.linear_dianzika)
//    LinearLayout linearDianzika;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.layout_scan_note, null);
//        ButterKnife.inject(this, view);

        ButterKnife.inject(this, view);
        return view;


    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.reset(this);
    }

    @OnClick({R.id.iv_help,  R.id.button_erweima, R.id.linear_shitika, R.id.linear_dianzika})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.iv_help:
                if(Variable.state){
                    Intent intent1 = new Intent(getActivity(), Login.class);
                    startActivity(intent1);
                }else{
                    Intent intent2 = new Intent(getActivity(), Indent.class);
                    startActivity(intent2);
                }
                break;

            case R.id.button_erweima:
                if(Variable.state){
                    Intent intent1 = new Intent(getActivity(), Login.class);
                    startActivity(intent1);
                }else{
                    Intent intent2 = new Intent(getActivity(), Indent.class);
                    startActivity(intent2);
                }
                break;
            case R.id.linear_shitika:
                if(Variable.state){
                    Intent intent1 = new Intent(getActivity(), Login.class);
                    startActivity(intent1);
                }else{
                    Intent intent2 = new Intent(getActivity(), Indent.class);
                    startActivity(intent2);
                }
                break;
            case R.id.linear_dianzika:
                if(Variable.state){
                    Intent intent1 = new Intent(getActivity(), Login.class);
                    startActivity(intent1);
                }else{
                    Intent intent2 = new Intent(getActivity(), Indent.class);
                    startActivity(intent2);
                }
                break;
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        ButterKnife.reset(this);
    }


    //    @Override
//    public void onDestroyView() {
//        super.onDestroyView();
//        ButterKnife.reset(this);
//    }

//
//    @OnClick({R.id.iv_help, R.id.button_erweima, R.id.linear_shitika, R.id.linear_dianzika})
//    public void onClick(View view) {
//        switch (view.getId()) {
//            case R.id.iv_help:
//                Intent intent= new Intent();
//                intent.setClass(getActivity(),HtlpActivity.class);
//                startActivity(intent);
//                break;
//            case R.id.button_erweima:
//                Intent intent1= new Intent();
//                intent1.setClass(getActivity(),DengLuActivity.class);
//                startActivity(intent1);
//                break;
//            case R.id.linear_shitika:
//                Intent intent2= new Intent();
//                intent2.setClass(getActivity(),DengLuActivity.class);
//                startActivity(intent2);
//                break;
//            case R.id.linear_dianzika:
//                Intent intent3= new Intent();
//                intent3.setClass(getActivity(),DengLuActivity.class);
//                startActivity(intent3);
//                break;
//        }
//
//    }
}
